const fs = require('fs');
const path = require('path');
const metadataPath = path.join(__dirname, 'metadata.json'); // 只写 'metadata.json'

const raw = fs.readFileSync(metadataPath, 'utf8');
const obj = JSON.parse(raw);

const images = Object.values(obj);

fs.writeFileSync(
  metadataPath,
  JSON.stringify({ images }, null, 2),
  'utf8'
);

console.log('metadata.json 格式已修复！');